<%--
  Created by IntelliJ IDEA.
  User: Stiofan
  Date: 2017/1/19
  Time: 16:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/common/tags.jsp" %>

<aos:html title="土地租赁信息管理" base="http" lib="ext">
    <aos:body>
    </aos:body>
</aos:html>
<aos:onready>
    <aos:viewport layout="fit">
        <aos:panel layout="column" columnWidth="1" border="false" autoScroll="true">
            <aos:formpanel id="tdjcxxForm" layout="column" columnWidth="1">
                <aos:fieldset title="土地基础信息" collapsible="false">
                    <aos:textfield id="tdbh" name="tdbh" fieldLabel="土地编号" columnWidth="0.25"
                                   onenterkey="queryTdjcxxByTdbh" star="true" allowBlank="false"/>
                    <aos:textfield id="tdzmj" name="tdzmj" fieldLabel="土地面积(平米)" columnWidth="0.25" readOnly="true"/>
                    <aos:textfield id="zldz" name="zldz" fieldLabel="坐落地址" columnWidth="0.5" readOnly="true"/>
                    <aos:fieldset title="土地边界四至" collapsible="false">
                        <aos:textfield name="tdbjszD" fieldLabel="东" columnWidth="0.25" readOnly="true"/>
                        <aos:textfield name="tdbjszX" fieldLabel="西" columnWidth="0.25" readOnly="true"/>
                        <aos:textfield name="tdbjszN" fieldLabel="南" columnWidth="0.25" readOnly="true"/>
                        <aos:textfield name="tdbjszB" fieldLabel="北" columnWidth="0.25" readOnly="true"/>
                    </aos:fieldset>
                </aos:fieldset>
            </aos:formpanel>
            <aos:gridpanel id="tdsyqGrid" forceFit="true" layout="fit" columnWidth="1"
                           url="tdczxxglService.queryTdczxxByTdbh" hidePagebar="true" autoScroll="true">
                <aos:selmodel type="checkbox" mode="single"/>
                <aos:column header="登记序号" dataIndex="djxh" hidden="true"/>
                <aos:column header="土地使用权UUID" dataIndex="tdsyquuid" hidden="true"/>
                <aos:column header="土地编号" dataIndex="tdbh" hidden="true"/>
                <aos:column header="承租人识别号" dataIndex="nsrsbh" align="center"/>
                <aos:column header="承租人名称" dataIndex="nsrmc" align="center"/>
                <aos:column header="使用人类型" dataIndex="tdsyrlxDm" rendererField="tdsyrlxDm" hidden="true"/>
                <aos:column header="租赁起始日期" dataIndex="tdsyqQsrq" align="center" type="date" format="Y-m-d"/>
                <aos:column header="租赁终止日期" dataIndex="tdsyqZzrq" align="center" type="date" format="Y-m-d"/>
                <aos:column header="租赁面积" dataIndex="tdsyqYsmj" align="right" type="number" format="0.00"/>
                <aos:column header="租赁金额(月)" dataIndex="tdsyqYsje" align="right" type="number" format="0.00"/>
                <aos:column header="租赁金额(年)" dataIndex="tdsyqZlje" align="right" type="number" format="0.00"/>
            </aos:gridpanel>
            <aos:window id="tdczxxxxWin" title="土地租赁详细信息" width="1000" maxHeight="460">
                <aos:panel layout="column" columnWidth="1">
                    <aos:formpanel id="ryjcxxForm" layout="column" columnWidth="1">
                        <aos:fieldset title="承租人基础信息" collapsible="false">
                            <aos:hiddenfield id="djxh" name="djxh"/>
                            <aos:textfield id="nsrsbh" name="nsrsbh" fieldLabel="承租人识别号" columnWidth="0.5"
                                           onenterkey="queryRyjcxx" star="true" allowBlank="false"/>
                            <aos:hiddenfield id="shxydm" name="shxydm" fieldLabel="社会信用代码" columnWidth="0.5"
                                             onenterkey="queryRyjcxx"/>
                            <aos:hiddenfield id="zzjgdm" name="zzjgdm" fieldLabel="组织机构代码" columnWidth="0.5"
                                             onenterkey="queryRyjcxx"/>
                            <aos:textfield id="nsrmc" name="nsrmc" fieldLabel="承租人名称" columnWidth="0.5"
                                           readOnly="true"/>
                            <aos:textfield id="lxrxm" name="lxrxm" fieldLabel="联系人姓名" columnWidth="0.5"
                                           readOnly="true"/>
                            <aos:combobox id="lxrsfzjlxDm" name="lxrsfzjlxDm" fieldLabel="证件类型" dicField="sfzjlxDm"
                                          columnWidth="0.5" dicFilter="201" readOnly="true"/>
                            <aos:textfield id="lxrsfzjhm" name="lxrsfzjhm" fieldLabel="证件号码" columnWidth="0.5"
                                           readOnly="true"/>
                            <aos:textfield id="lxrgddh" name="lxrgddh" fieldLabel="固定电话" columnWidth="0.5"
                                           readOnly="true"/>
                            <aos:textfield id="lxryddh" name="lxryddh" fieldLabel="移动电话" columnWidth="0.5"
                                           readOnly="true"/>
                            <aos:textfield id="lxrdz" name="lxrdz" fieldLabel="联系人地址" columnWidth="0.5"
                                           readOnly="true"/>
                        </aos:fieldset>
                    </aos:formpanel>
                    <aos:formpanel id="tdsyqdjxxForm" layout="column" columnWidth="1">
                        <aos:fieldset title="承租土地信息" collapsible="false">
                            <aos:hiddenfield id="tdsyquuid" name="tdsyquuid"/>
                            <aos:hiddenfield id="tdsyrlxDm" name="tdsyrlxDm" fieldLabel="使用人类型"
                                             columnWidth="0.5" value="05"/>
                            <aos:hiddenfield id="tdsyqlxDm" name="tdsyqlxDm" fieldLabel="使用权类型"
                                             columnWidth="0.5" value="03"/>
                            <aos:hiddenfield id="tdsyqZsbh" name="tdsyqZsbh" fieldLabel="使用权证书编号" columnWidth="0.5"/>
                            <aos:hiddenfield id="tdsyqQdrq" name="tdsyqQdrq" fieldLabel="使用权取得日期" columnWidth="0.5"/>
                            <aos:datefield id="tdsyqQsrq" name="tdsyqQsrq" fieldLabel="租赁起始日期" columnWidth="0.5"
                                           star="true" allowBlank="false"/>
                            <aos:datefield id="tdsyqZzrq" name="tdsyqZzrq" fieldLabel="租赁终止日期" columnWidth="0.5"
                                           star="true" allowBlank="false"/>
                            <aos:textfield id="tdsyqYsmj" name="tdsyqYsmj" fieldLabel="租赁面积" columnWidth="0.5"
                                           regex="/^[0-9]+([.]{1}[0-9]{1,2})?$/" regexText="必输输入数字并且保留至多两位小数"
                                           msgTarget="under" onblur="calcForTdsyqZlje" star="true" allowBlank="false"/>
                            <aos:textfield id="tdsyqYsje" name="tdsyqYsje" fieldLabel="租赁金额(月)" columnWidth="0.5"
                                           regex="/^[0-9]+([.]{1}[0-9]{1,2})?$/" regexText="必输输入数字并且保留至多两位小数"
                                           msgTarget="under" onblur="calcForTdsyqZlje" star="true" allowBlank="false"/>
                            <aos:hiddenfield id="tdsyqMsmj" name="tdsyqMsmj" fieldLabel="使用权免税面积" columnWidth="0.5"
                                             regex="/^[0-9]+([.]{1}[0-9]{1,2})?$/" regexText="必输输入数字并且保留至多两位小数"
                                             msgTarget="under"/>
                            <aos:hiddenfield id="tdsyqMsje" name="tdsyqMsje" fieldLabel="使用权免税金额" columnWidth="0.5"
                                             regex="/^[0-9]+([.]{1}[0-9]{1,2})?$/" regexText="必输输入数字并且保留至多两位小数"
                                             msgTarget="under"/>
                            <aos:textfield id="tdsyqZlje" name="tdsyqZlje" fieldLabel="租赁金额(年)" columnWidth="0.5"
                                           regex="/^[0-9]+([.]{1}[0-9]{1,2})?$/" regexText="必输输入数字并且保留至多两位小数"
                                           msgTarget="under" readOnly="true" star="true" allowBlank="false"/>
                        </aos:fieldset>
                    </aos:formpanel>
                </aos:panel>
                <aos:docked dock="bottom" ui="footer" columnWidth="1">
                    <aos:dockeditem xtype="tbfill"/>
                    <aos:dockeditem id="btnSave" text="保存" onclick="saveTdsyqdjxx" icon="ok.png"/>
                    <aos:dockeditem id="btnDel" text="作废" onclick="#zfTdsyqdjxxWin.show();" icon="del.png"/>
                    <aos:dockeditem text="关闭" onclick="#tdczxxxxWin.close();" icon="close.png"/>
                </aos:docked>
            </aos:window>
            <aos:window id="zfTdsyqdjxxWin" title="作废土地租赁信息" width="1000" maxHeight="460">
                <aos:formpanel id="zfTdsyqdjxxForm" layout="column" autoScroll="true">
                    <aos:textareafield id="zfyy" name="zfyy" fieldLabel="作废原因" labelWidth="60" columnWidth="1"
                                       height="200"/>
                    <aos:docked dock="bottom" ui="footer">
                        <aos:dockeditem xtype="tbfill"/>
                        <aos:dockeditem text="作废" onclick="zfTdsysdjxxByTdsyquuid" icon="del.png"/>
                        <aos:dockeditem text="关闭" onclick="#zfTdsyqdjxxWin.close();" icon="close.png"/>
                    </aos:docked>
                </aos:formpanel>
            </aos:window>
            <aos:window id="tdsyqJmxxWin" layout="column" title="土地使用权减免信息" width="1000" maxHeight="460">
                <aos:gridpanel id="tdsyqJmxxGrid" forceFit="true"
                               url="tdsyqdjglService.queryTdsyqJmxxByTdsyquuid"
                               hidePagebar="true" columnWidth="1" height="420">
                    <aos:selmodel type="checkbox" mode="single"/>
                    <aos:column header="土地等级明细UUID" dataIndex="tddjmxuuid" hidden="true"/>
                    <aos:column header="土地减免明细UUID" dataIndex="tdsyqjmuuid" hidden="true"/>
                    <aos:column header="土地编号" dataIndex="tdbh" hidden="true"/>
                    <aos:column header="土地等级" dataIndex="tddjDm" rendererField="tddjDm" align="center"/>
                    <aos:column header="税额代码" dataIndex="dwseDm" hidden="true"/>
                    <aos:column header="税额标准" dataIndex="sebz" align="center"/>
                    <aos:column header="土地面积" dataIndex="tdmj" format="0.00" type="number"/>
                    <aos:column header="应纳税额" dataIndex="ynse" format="0.00" type="number"/>
                    <aos:column header="减免性质" dataIndex="tdjmxzDm" rendererField="tdjmxzDm" align="center"/>
                    <aos:column header="减免面积" dataIndex="jmmj" format="0.00" type="number"/>
                    <aos:column header="减免税额" dataIndex="jmse" format="0.00" type="number"/>
                    <aos:column header="有效期起" dataIndex="jmYxqq" format="Y-m-d" type="date" align="center"/>
                    <aos:column header="有效期止" dataIndex="jmYxqz" format="Y-m-d" type="date" align="center"/>
                </aos:gridpanel>
                <aos:docked dock="bottom" ui="footer">
                    <aos:dockeditem xtype="tbfill"/>
                    <aos:dockeditem text="修改" onclick="openTddjJmmxxxWin" icon="ok.png"/>
                    <aos:dockeditem text="关闭" onclick="#tdsyqJmxxWin.close();" icon="close.png"/>
                </aos:docked>
            </aos:window>
            <aos:window id="tddjJmmxxxWin" width="1000" maxHeight="460">
                <aos:formpanel id="tddjJmmxxxForm" layout="column" columnWidth="1">
                    <aos:fieldset title="土地等级减免明细信息" collapsible="false">
                        <aos:hiddenfield id="tddjmxuuid" name="tddjmxuuid"/>
                        <aos:hiddenfield id="tdsyqjmuuid" name="tdsyqjmuuid"/>
                        <aos:combobox id="tdjmxzDm" name="tdjmxzDm" fieldLabel="减免性质" dicField="tdjmxzDm"
                                      columnWidth="0.5"/>
                        <aos:textfield id="jmmj" name="jmmj" fieldLabel="减免面积" columnWidth="0.5"/>
                        <aos:datefield id="jmYxqq" name="jmYxqq" fieldLabel="有效期起" columnWidth="0.5"/>
                        <aos:datefield id="jmYxqz" name="jmYxqz" fieldLabel="有效期止" columnWidth="0.5"/>
                    </aos:fieldset>
                </aos:formpanel>
                <aos:docked dock="bottom" ui="footer">
                    <aos:dockeditem xtype="tbfill"/>
                    <aos:dockeditem text="保存" onclick="saveTddjJmmxxx" icon="ok.png"/>
                    <aos:dockeditem text="作废" onclick="#zfTddjjmxxWin.show();" icon="del.png"/>
                    <aos:dockeditem text="关闭" onclick="#tddjJmmxxxWin.close();" icon="close.png"/>
                </aos:docked>
            </aos:window>
            <aos:window id="zfTddjjmxxWin" title="作废土地等级减免信息" width="1000" maxHeight="460">
                <aos:formpanel id="zfTddjjmxxForm" layout="column" autoScroll="true">
                    <aos:textareafield id="zfyyJm" name="zfyyJm" fieldLabel="作废原因" labelWidth="60" columnWidth="1"
                                       height="200"/>
                    <aos:docked dock="bottom" ui="footer">
                        <aos:dockeditem xtype="tbfill"/>
                        <aos:dockeditem text="作废" onclick="zfTddjjmxxByTdsyqjmuuid" icon="del.png"/>
                        <aos:dockeditem text="关闭" onclick="#zfTddjjmxxWin.close();" icon="close.png"/>
                    </aos:docked>
                </aos:formpanel>
            </aos:window>
            <aos:docked dock="bottom" ui="footer" columnWidth="1" layout="column" border="false">
                <aos:panel layout="column" columnWidth="1" border="false">
                    <aos:panel layout="column" columnWidth="0.375" center="true" animate="false" border="false">
                        <aos:button id="btnAdd" text="新增" columnWidth="0.33" margin="2" onclick="openTdczxxxxWin"/>
                        <aos:button id="btnMod" text="修改" columnWidth="0.33" margin="2" onclick="modTdcxxxxx"/>
                        <aos:button text="重置" columnWidth="0.33" margin="2" onclick="resetAllForms"/>
                        <%--<aos:button text="减免" columnWidth="0.25" margin="2" onclick="openTdsyqjmxxWin"/>--%>
                    </aos:panel>
                </aos:panel>
            </aos:docked>
        </aos:panel>
    </aos:viewport>
    <script type="text/javascript">
        function queryTdjcxxByTdbh() {
            if (tdbh.getValue() === "") {
                AOS.err("必须输入土地编号进行查询");
            } else {
                var params = {
                    tdbh: tdbh.getValue()
                };
                AOS.ajax({
                    params: params,
                    url: "tdjcxxcjService.queryTdjcxxByTdbh",
                    ok: function (data) {
                        if (data.appcode === "err") {
                            AOS.err("未查询到土地基础信息，请先采集土地基础信息!");
                            AOS.edit(tdbh);
                        } else {
                            AOS.read(tdbh);
                            AOS.setValues(tdjcxxForm, data);
                            queryTdczxxByTdbh();
                            Ext.getCmp("btnAdd").setDisabled(false);
                            Ext.getCmp("btnMod").setDisabled(false);
                        }
                    }
                });
            }
        }
        function queryRyjcxx() {
            if (djxh.getValue() === "") {
                if (nsrsbh.getValue() === "" && shxydm.getValue() === "" && zzjgdm.getValue() === "") {
                    AOS.err("必须输入纳税人识别号、社会信用代码、组织机构代码其中一项进行查询");
                    return;
                } else {
                    if (nsrsbh.getValue() !== "" && shxydm.getValue() === "" && zzjgdm.getValue() === "") {
                    } else if (nsrsbh.getValue() === "" && shxydm.getValue() !== "" && zzjgdm.getValue() === "") {
                    } else if (nsrsbh.getValue() === "" && shxydm.getValue() === "" && zzjgdm.getValue() !== "") {
                    } else {
                        AOS.err("仅能通过纳税人识别号、社会信用代码、组织机构代码其中一项进行查询");
                        return;
                    }

                }
            }
            var params = {
                nsrsbh: nsrsbh.getValue(),
                shxydm: nsrsbh.getValue(),
                zzjgdm: nsrsbh.getValue(),
                djxh: Ext.getCmp("djxh").getValue()
            };
            AOS.ajax({
                params: params,
                url: "tdczxxglService.queryRyjcxx",
                ok: function (data) {
                    if (data.appcode === "noRyxx") {
                        AOS.err("未查询到相关信息，请先进行人员基础信息采集!");
                        AOS.edit(nsrsbh);
                        AOS.edit(shxydm);
                        AOS.edit(zzjgdm);
                    } else {
                        AOS.read(nsrsbh);
                        AOS.read(shxydm);
                        AOS.read(zzjgdm);
                        AOS.setValues(ryjcxxForm, data);
                    }
                }
            });

        }
        function queryTdczxxByTdbh() {
            var params = {
                tdbh: Ext.getCmp("tdbh").getValue()
            };
            tdsyqGrid_store.getProxy().extraParams = params;
            tdsyqGrid_store.reload();
        }
        function saveTdsyqdjxx() {
            if (AOS.valid(tdsyqdjxxForm)) {

                if (Ext.getCmp("tdsyqYsmj").getValue() === "") {
                    AOS.setValue("tdsyqYsmj", 0);
                }
                if ("" === Ext.getCmp("tdsyqMsmj").getValue()) {
                    AOS.setValue("tdsyqMsmj", 0);
                }
                if (Ext.getCmp("tdsyqYsje").getValue() === "") {
                    AOS.setValue("tdsyqYsje", 0);
                }
                if (Ext.getCmp("tdsyqMsje").getValue() === "") {
                    AOS.setValue("tdsyqMsje", 0);
                }
                var params = {
                    djxh: Ext.getCmp("djxh").getValue(),
                    tdbh: Ext.getCmp("tdbh").getValue(),
                    tdzmj: Ext.getCmp("tdzmj").getValue()
                };
                var tdysymj = 0;//定义土地已使用面积，用于累加已经登记使用权的应税面积及免税面积
                for (var i = 0; i < tdsyqGrid_store.getCount(); i++) {
                    var record = tdsyqGrid_store.getAt(i);
                    if (Ext.getCmp("tdbh").getValue() === record.data.tdbh && Ext.getCmp("tdsyquuid").getValue() !== record.data.tdsyquuid) {
                        tdysymj = tdysymj + parseFloat(record.data.tdsyqYsmj) + parseFloat(record.data.tdsyqMsmj);
                        //当使用人类型与使用权类型已经存在登记过的信息是，将校验是否存在日期交叉情况
                        if (Ext.getCmp("tdsyrlxDm").getValue() === record.data.tdsyrlxDm &&
                            Ext.getCmp("tdsyqlxDm").getValue() === record.data.tdsyqlxDm) {
                            if ((Date.parse(Ext.getCmp("tdsyqQsrq").getValue()) <= Date.parse(record.data.tdsyqQsrq.substr(0, 10)) &&
                                Date.parse(Ext.getCmp("tdsyqZzrq").getValue()) >= Date.parse(record.data.tdsyqQsrq.substr(0, 10))) ||
                                (Date.parse(Ext.getCmp("tdsyqQsrq").getValue()) <= Date.parse(record.data.tdsyqZzrq.substr(0, 10)) &&
                                Date.parse(Ext.getCmp("tdsyqZzrq").getValue()) >= Date.parse(record.data.tdsyqZzrq.substr(0, 10))) ||
                                (Date.parse(Ext.getCmp("tdsyqQsrq").getValue()) <= Date.parse(record.data.tdsyqQsrq.substr(0, 10)) &&
                                Date.parse(Ext.getCmp("tdsyqZzrq").getValue()) >= Date.parse(record.data.tdsyqZzrq.substr(0, 10))) ||
                                (Date.parse(Ext.getCmp("tdsyqQsrq").getValue()) >= Date.parse(record.data.tdsyqQsrq.substr(0, 10)) &&
                                Date.parse(Ext.getCmp("tdsyqZzrq").getValue()) <= Date.parse(record.data.tdsyqZzrq.substr(0, 10)))) {
                                AOS.err("针对同一使用人类型及使用权类型，不允许存在多条登记信息!");
                                return;
                            }
                        }
                    }
                }
                var tddjzmj = parseFloat(Ext.getCmp("tdsyqYsmj").getValue()) + parseFloat(Ext.getCmp("tdsyqMsmj").getValue()) + parseFloat(tdysymj);
                //校验面积
                if (tddjzmj > parseFloat(Ext.getCmp("tdzmj").getValue())) {
                    AOS.err("本次登记的使用权面积与已登记的使用权面积之和(" + tddjzmj + ")大于土地总面积(" + parseFloat(Ext.getCmp("tdzmj").getValue()) + "),请检查所填应税面积、免税面积是否正确!");
                    return;
                }
                AOS.ajax({
                    params: params,
                    forms: tdsyqdjxxForm,
                    url: "tdsyqdjglService.saveTdsyqdjxx",
                    ok: function (data) {
                        if (data.appcode === "suc") {
                            AOS.tip("土地产权信息保存成功！");
                            tdsyqGrid_store.reload();
                            Ext.getCmp("btnSave").setDisabled(true);
                        } else if (data.appcode === "err") {
                            AOS.err(data.appmsg);
                        }

                    }
                });
            } else {
                AOS.err("请检查相关信息是否输入完整！");
            }
        }
        function zfTdsysdjxxByTdsyquuid() {
            var params = {
                tdsyquuid: Ext.getCmp("tdsyquuid").getValue()
            };
            AOS.ajax({
                params: params,
                forms: zfTdsyqdjxxForm,
                url: "tdczxxglService.zfTdsysdjxxByTdsyquuid",
                ok: function (data) {
                    if (data.appcode === "suc") {
                        AOS.tip("土地使用权信息作废成功!");
                        tdsyqGrid_store.reload();
                        AOS.reset(tdsyqdjxxForm);
                        AOS.reset(ryjcxxForm);
                        nsrsbh.setReadOnly(false);
                        shxydm.setReadOnly(false);
                        zzjgdm.setReadOnly(false);
                    } else if (data.appcode === "err") {
                        AOS.err(data.appmsg);
                    }
                    zfTdsyqdjxxWin.close();
                }
            });
        }
        function resetAllForms() {
            AOS.reset(ryjcxxForm);
            AOS.reset(tdjcxxForm);
            AOS.reset(tdsyqdjxxForm);
            nsrsbh.setReadOnly(false);
            shxydm.setReadOnly(false);
            zzjgdm.setReadOnly(false);
            tdbh.setReadOnly(false);
            tdsyqGrid_store.removeAll();
            Ext.getCmp("btnAdd").setDisabled(true);
        }
        function modTdcxxxxx() {
            var record = AOS.selectone(Ext.getCmp("tdsyqGrid"));
            AOS.reset(ryjcxxForm);
            AOS.reset(tdsyqdjxxForm);
            AOS.setValue("ryjcxxForm.djxh", record.data.djxh);
            AOS.setValue("tdsyqdjxxForm.tdsyquuid", record.data.tdsyquuid);
            queryRyjcxx();
            queryTdsyqdjxx();
            Ext.getCmp("tdczxxxxWin").show();
        }
        function queryTdsyqdjxx() {
            var params = {
                djxh: Ext.getCmp("djxh").getValue(),
                tdbh: Ext.getCmp("tdbh").getValue(),
                tdsyquuid: tdsyquuid.getValue()
            };
            AOS.ajax({
                params: params,
                url: "tdsyqdjglService.queryTdsyqdjxxByTdsyquuid",
                ok: function (data) {
                    AOS.setValues(tdsyqdjxxForm, data);
                    if (data.tdsyqQsrq !== undefined && data.tdsyqQsrq !== "") {
                        AOS.setValue("tdsyqdjxxForm.tdsyqQsrq", Ext.Date.parse(data.tdsyqQsrq.substr(0, 10), 'Y-m-d', true));
                    }
                    if (data.tdsyqZzrq !== undefined && data.tdsyqZzrq !== "") {
                        AOS.setValue("tdsyqdjxxForm.tdsyqZzrq", Ext.Date.parse(data.tdsyqZzrq.substr(0, 10), 'Y-m-d', true));
                    }
                    if (data.tdsyqQdrq !== undefined && data.tdsyqQdrq !== "") {
                        AOS.setValue("tdsyqdjxxForm.tdsyqQdrq", Ext.Date.parse(data.tdsyqQdrq.substr(0, 10), 'Y-m-d', true));
                    }
                }
            });
        }
        function openTdczxxxxWin() {
            nsrsbh.setReadOnly(false);
            shxydm.setReadOnly(false);
            zzjgdm.setReadOnly(false);
            AOS.reset(ryjcxxForm);
            AOS.reset(tdsyqdjxxForm);
            Ext.getCmp("tdczxxxxWin").show();
        }
        function openTdsyqjmxxWin() {
            var record = AOS.selectone(Ext.getCmp("tdsyqGrid"));
            var params = {
                tdsyquuid: record.data.tdsyquuid
            };
            tdsyqJmxxGrid_store.getProxy().extraParams = params;
            tdsyqJmxxGrid_store.reload();
            Ext.getCmp("tdsyquuid").setValue(record.data.tdsyquuid);
            Ext.getCmp("tdsyqJmxxWin").show();
        }
        function openTddjJmmxxxWin() {
            var record = AOS.selectone(Ext.getCmp("tdsyqJmxxGrid"));
            Ext.getCmp("tdjmxzDm").setValue(record.data.tdjmxzDm);
            Ext.getCmp("jmmj").setValue(record.data.jmmj);
            Ext.getCmp("jmYxqq").setValue(record.data.jmYxqq);
            Ext.getCmp("jmYxqz").setValue(record.data.jmYxqz);
            Ext.getCmp("tddjmxuuid").setValue(record.data.tddjmxuuid);
            Ext.getCmp("tdsyqjmuuid").setValue(record.data.tdsyqjmuuid);
            Ext.getCmp("tddjJmmxxxWin").show();
        }
        function saveTddjJmmxxx() {
            if (AOS.valid(tddjJmmxxxForm)) {
                var params = {
                    tdsyquuid: Ext.getCmp("tdsyquuid").getValue()
                };
                AOS.ajax({
                    params: params,
                    forms: tddjJmmxxxForm,
                    url: "tdsyqdjglService.saveTddjJmmxxx",
                    ok: function (data) {
                        if (data.appcode === "suc") {
                            AOS.tip("减免信息保存成功!");
                            AOS.setValues(tddjJmmxxxForm, data);
                            tdsyqJmxxGrid_store.reload();
                        } else {
                            AOS.err(data.appmsg);
                        }
                    }
                });
            } else {
                AOS.err("请检查相关信息是否输入完整！");
            }
        }
        function zfTddjjmxxByTdsyqjmuuid() {
            var params = {
                tdsyqjmuuid: Ext.getCmp("tdsyqjmuuid").getValue()
            };
            AOS.ajax({
                params: params,
                forms: zfTddjjmxxForm,
                url: "tdsyqdjglService.zfTddjjmxxByTdsyqjmuuid",
                ok: function (data) {
                    if (data.appcode === "suc") {
                        AOS.tip("土地等级减免信息作废成功!");
                        tdsyqJmxxGrid_store.reload();
                        Ext.getCmp("tddjJmmxxxWin").close();
                        Ext.getCmp("zfTddjjmxxWin").close();
                    } else {
                        AOS.err(data.appmsg);
                    }
                }
            });
        }
        function calcForTdsyqZlje() {
            var zlje = Ext.getCmp("tdsyqYsje").getValue() * 12;
            Ext.getCmp("tdsyqZlje").setValue(Number(zlje).toFixed(2));
        }
    </script>
    Ext.getCmp("btnAdd").setDisabled(true);
    Ext.getCmp("btnMod").setDisabled(true);
</aos:onready>
